const express = require('express')
const app = express()
const port = 4000

const cors = require('cors')
app.use(cors())
const getUserInfo = {
    dec: {
        code: "000000",
        msg: "success",
        success: true
    },
    data: {
        token: '11111111111111',
        name: 'AAA',
    }
}
const loginByUsername = {
    dec: {
        code: "000000",
        msg: "success",
        success: true
    },
    data: {
        token: '11111111111111',
        name: 'AAA',
    }
}

const getRouters = {
    dec: {
        code: "000000",
        msg: "success",
        success: true
    },
    data: [
        {
            sys: '*',
            icon: 'el-icon-house',
            path: '/system',
            component: 'home',
            name: 'system',
            menuName: '系统管理',
            type:'M',
            perms: '',
            hidden: 1,
            children: [
                {
                    icon: 'el-icon-discount',
                    path: 'menu',
                    component: 'system/menu',
                    name: 'menu',
                    menuName: '菜单管理',
                    type:'C',
                    perms: '',
                    hidden: 1,
                    children: [
                        {
                            path: '',
                            name: '',
                            menuName: '菜单删除',
                            perms: 'menu_del',
                            type:'F',
                            hidden: 0,
                        },
                        {
                            path: '',
                            name: '',
                            menuName: '菜单新增',
                            perms: 'menu_add',
                            type:'F',
                            hidden: 0,
                        },
                        {
                            path: '',
                            name: '',
                            menuName: '菜单详情',
                            perms: 'menu_detail',
                            type:'F',
                            hidden: 0,
                        }
                    ]
                },
            ]
        },
        {
            sys: '*',
            icon: 'el-icon-house',
            path: '/index',
            component: 'index',
            name: 'index',
            menuName: '全屏首页',
            type:'C',
            perms: '',
            hidden: 1,
        },
        {
            sys: '*',
            icon: 'el-icon-house',
            path: '/index/index2',
            component: 'home',
            name: 'index2',
            menuName: '半屏首页',
            type:'C',
            perms: '',
            hidden: 1,
        },
        {
            sys: 1,
            icon: 'el-icon-house',
            path: '/one',
            component: 'home',
            name: 'one',
            menuName: '用户系统',
            type:'M',
            perms: '',
            hidden: 1,
            children: [
                {
                    icon: 'el-icon-discount',
                    path: 'oneIndex',
                    component: 'one/index',
                    name: 'oneIndex',
                    menuName: '用户系统首页',
                    type:'C',
                    perms: '',
                    hidden: 1,
                }, {
                    icon: 'el-icon-collection',
                    path: 'oneHW',
                    component: 'one/HelloWorld',
                    name: 'oneHW',
                    menuName: '用户系统HW',
                    type:'C',
                    perms: '',
                    hidden: 1,
                }, {
                    icon: 'el-icon-bank-card',
                    path: 'oneItem',
                    component: 'otherIndex',
                    menuName: '用户系统Item',
                    type:'M',
                    name: 'oneItem',
                    perms: '',
                    hidden: 1,
                    children:[
                        {
                            type:'C',
                            icon: 'el-icon-discount',
                            path: 'threeIndex',
                            component: 'one/threeIndex/index',
                            name: 'threeIndex',
                            perms: '',
                            menuName: '用户系统Item3级',
                            hidden: 1,
                        },
                        {
                            type:'C',
                            icon: 'el-icon-discount',
                            path: 'threeIndexOther',
                            component: 'one/threeIndex/other',
                            name: 'threeIndexOther',
                            perms: '',
                            menuName: '用户系统Item3级其他',
                            hidden: 1,
                        },
                    ],
                }
            ]
        },
        {
            sys: 2,
            icon: 'el-icon-house',
            path: '/two',
            component: 'home',
            name: 'two',
            menuName: '设备系统',
            perms: '',
            type:'M',
            hidden: 1,
            children: [
                {
                    icon: 'el-icon-discount',
                    path: 'twoIndex',
                    component: 'two/index',
                    name: 'twoIndex',
                    perms: '',
                    menuName: '设备系统首页',
                    type:'C',
                    hidden: 1,
                    children: [
                        {
                            path: '',
                            component: 'home',
                            name: '',
                            perms: 'twoIndex_del',
                            menuName: '设备系统首页删除',
                            type:'F',
                            hidden: 0,
                        },
                        {
                            path: '',
                            component: 'home',
                            name: '',
                            perms: 'twoIndex_add',
                            menuName: '设备系统首页新增',
                            type:'F',
                            hidden: 0,
                        },
                        {
                            path: '',
                            component: 'home',
                            name: '',
                            perms: 'twoIndex_detail',
                            menuName: '设备系统首页详情',
                            type:'F',
                            hidden: 0,
                        }
                    ]
                },
                {
                    icon: 'el-icon-collection',
                    path: 'twoHW',
                    component: 'two/HelloWorld',
                    name: 'twoHW',
                    menuName: '设备系统HW',
                    type:'C',
                    perms: '',
                    hidden: 1,
                    children: [
                        {
                            path: '',
                            name: '',
                            perms: 'twoItem_del',
                            menuName: '设备系统HW删除',
                            type:'F',
                            hidden: 1,
                        },
                        {
                            path: '',
                            name: '',
                            perms: 'twoItem_add',
                            menuName: '设备系统HW新增',
                            type:'F',
                            hidden: 0,
                        },
                        {
                            path: '',
                            name: '',
                            perms: 'twoItem_detail',
                            menuName: '设备系统HW详情',
                            type:'F',
                            hidden: 1,
                        }
                    ]
                },
                {
                    icon: 'el-icon-bank-card',
                    path: 'twoItem',
                    component: 'two/item',
                    name: 'twoItem',
                    menuName: '设备系统Item',
                    type:'C',
                    perms: '',
                    hidden: 1,
                    children: [
                        {
                            path: '',
                            name: '',
                            perms: 'twoItem_del',
                            menuName: '设备系统Item删除',
                            type:'F',
                            hidden: 1,
                        },
                        {
                            path: '',
                            name: '',
                            perms: 'twoItem_add',
                            menuName: '设备系统Item新增',
                            type:'F',
                            hidden: 0,
                        },
                        {
                            path: '',
                            name: '',
                            perms: 'twoItem_detail',
                            menuName: '设备系统Item详情',
                            type:'F',
                            hidden: 1,
                        }
                    ]
                }
            ]
        },
        {
            path: '/404',
            component: '404',
            name: '404',
        },
    ]
}

app.get('/loginByUsername', (req, res) => {
    res.send(loginByUsername)
})

app.get('/getUserInfo', (req, res) => {
    res.send(getUserInfo)
})

app.get('/getRouters', (req, res) => {
    res.send(getRouters)
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})
